function login() {
    var userName = $("#username").val();
    var passWord = $("#userPassword").val();
    if(userName == null || userName == ""){
        alert("对不起，用户名不能为空，请输入！");
        return;
    }
    if(passWord == null || passWord == ""){
        alert("对不起，密码不能为空，请输入！");
        return;
    }
    var paramData = {"username": userName,"userPassword": passWord,"token": cochoApp.getTokenByStorage()};
    $.ajax({
        type: "post",
        async: true,//异步，如果等于false 那么就是同步
        url: cochoApp.baseUrl + "/anonymous/phone/userInfoLogin.do",
        dataType: "json",
        data: paramData,
        success: function (data) {
            if (data != null) {
                if (data.statusCode == "SUCCESS") {
                    loginSuccess(data);
                } else {
                    alert(data.statusMsg);
                    return false;
                }
            } else {
                alert("登录失败,请联系管理员解决！");
                return false;
            }
        },
        error: function (data) {
            alert("请求服务器出错！");
            return false;
        }
    });
}

function loginSuccess(data) {
    cochoApp.setTokenToStorage(data.token);//如果是记住密码，则将Token信息存入cookie中
    if (cochoApp.isNotEmpty(data.content)) {
        cochoApp.setUserInfoToStorage(data.content);//将用户信息缓存到cookie中
    }
    window.location.href = cochoApp.baseUrl + "/control/phone/pay.jsp";
}